  <?php
		session_start(); 
		include "function/libfunc.php";
 			if (!empty($_SESSION['username']) && !empty($_SESSION['password'])) { 
		  	$link="Edit Member";
		  	include 'themes/head2.php';
			                              $link = koneksi_db();
                                        $sql = "select link,idmember,m.idmedia,nama,email,password,kodepos,tlp,m.idongkos,alamat,date,poin from member m join ongkos o on m.idongkos=o.idongkos join media mi on m.idmedia=mi.idmedia WHERE idmember= ".$_GET['idmember'];
                                        $hasil = mysql_query($sql,$link) or exit("Error query: <b>".$sql."</b>.");
										$data = mysql_fetch_assoc($hasil);
										?>

     <link href="plugins/forms/select/select2.css" type="text/css" rel="stylesheet" />    
    <link href="plugins/forms/ibutton/jquery.ibutton.css" type="text/css" rel="stylesheet" />

                    <div class="row-fluid">

                        <div class="span12">

                            <div class="page-header">
                                <h4>Edit Data Member</h4>
                            </div>
                            <div class="content">
								<form class="form-horizontal" action="fceditmember.php" method="post" enctype="multipart/form-data">
                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="username">Avatar:</label>
                                            <img src="server/php/files/small_<?php echo $data['link']; ?>" alt="" class="span3"/>
                                             <span class="span1"> <input type="hidden" name="idmedia" id="idmedia" value="<?php echo $data['idmedia']; ?>" /></span>
                                             <span class="hint"><input class="span2" type="file"  name="gambar" id="gambar" value="<?php echo $data['link']; ?>"/></span>
                                            
                                        </div>
                                    </div>
                                </div>

                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="name">Nama:</label>
                                             <input type="hidden" name="idmember" id="idmember" value="<?php echo $data['idmember']; ?>" />
                                             <input type="hidden" name="link" id="link" value="<?php echo $data['link']; ?>" />
                                            <input class="span7" id="nama"  value="<?php echo $data['nama']; ?>" type="text" name="nama" required />
                                            
                                        </div>
                                    </div>
                                </div>
                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="email">Email:</label>
                                            <input class="span7" id="email" type="text" name="email" value="<?php echo $data['email']; ?>" required />
                                        </div>
                                    </div>
                                </div>
                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="normal">Password:</label>
  
                                                <input class="span7" id="password" name="password" type="password" placeholder="Enter your password" value="<?php echo $data['password']; ?>" required /> 
  
                                        </div>
                                    </div>
                                </div>
                                
                                  <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span3" for="checkboxes">Kabupaten:</label>
                                                    <div class="span7 controls">   
                                                        <select name="ongkos" id="ongkos">
                                        <?php
                                        $link = koneksi_db();
                                        $sql = "select * from ongkos ORDER BY kabupaten ASC";
                                        $hasil = mysql_query($sql,$link) or exit("Error query: <b>".$sql."</b>.");
										while($data1= mysql_fetch_assoc($hasil)){
										?>
                                                            <option value="<?php echo $data1['idongkos']; ?>"><?php echo $data1['kabupaten']; ?></option>
                                                            <?php
															}
															?>
                                                        </select>
                                                    </div> 
                                                </div>
                                            </div> 
                                        </div>
                                        
                                        <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span3" for="checkboxes">Provinsi:</label>
                                                    <div class="span7 controls">   
                                                        <select  name="provinsi" id="provinsi">
                                        <?php
                                        $link = koneksi_db();
                                        $sql = "select * from ongkos ORDER BY provinsi ASC";
                                        $hasil = mysql_query($sql,$link) or exit("Error query: <b>".$sql."</b>.");
										while($data1= mysql_fetch_assoc($hasil)){
										?>
                                                            <option ><?php echo $data1['provinsi']; ?></option>
                                                            <?php
															}
															?>
                                                        </select>
                                                    </div> 
                                                </div>
                                            </div> 
                                        </div>
   
                                
                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="email">Kode Pos:</label>
                                            <input class="span7" id="kodepos" type="text" name="kodepos" value="<?php echo $data['kodepos']; ?>" required />
                                        </div>
                                    </div>
                                </div>

                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="textarea">Alamat:</label>
                                            <textarea name="alamat" class="span7 limit elastic" id="alamat" rows="3" cols="5" required><?php echo $data['alamat']; ?></textarea>
                                        </div>
                                    </div>  
                                </div>
                                
                                 <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="email">Telepon:</label>
                                            <input class="span7" id="tlp" type="text" name="tlp" value="<?php echo $data['tlp']; ?>" required />
                                        </div>
                                    </div>
                                </div>
                                                                
                                <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="email">Tanggal Masuk:</label>
                                            <input class="span7" id="date" type="text" name="date" value="<?php echo $data['date']; ?>" />
                                        </div>
                                    </div>
                                </div>
                                
                                 <div class="form-row row-fluid">
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <label class="form-label span3" for="email">Poin:</label>
                                            <input class="span7" id="poin" type="text" name="poin" value="<?php echo $data['poin']; ?>" />
                                        </div>
                                    </div>
                                </div>

                                
                                <div class="form-row row-fluid">        
                                    <div class="span12">
                                        <div class="row-fluid">
                                            <div class="form-actions">
                                            <div class="span2"></div>
                                            <div class="span10 controls">
                                                <button type="submit" class="btn btn-primary" class="submit"> Simpan</button>
                                                <button class="btn btn-warning" onclick="goBack()">Batalkan</button>
                                                <a class="btn btn-danger"  href="function/deletemember.php?idmember=<?php echo $data['idmember']; ?>" id="'.$data['idmember'].'"  onClick='alert("Apakah anda yakin ingging menghapus  <?php echo $data['nama']; ?> !")'><span class="icon-trash"></span> Hapus</a>
                                               
                                               
                                                                                 </div>
                                            </div>
                                        </div>
                                    </div>   
                                </div>


                            </form>
                          </div>
                        </div><!-- End .span12 -->

                    </div><!-- End .row-fluid -->
    <script type="text/javascript" src="plugins/forms/select/select2.min.js"></script>    
    <script type="text/javascript" src="plugins/forms/ibutton/jquery.ibutton.min.js"></script>
        <script type="text/javascript" src="js/empty.js"></script><!-- Init plugins only for page -->
    <script type="text/javascript">
    // document ready function
    $(document).ready(function() { 
     
        $("#tags").select2({
            tags:["red", "green", "blue", "orange"]
        });

        $(".ibuttonCheck").iButton({
             labelOn: "<span class='icon16 icomoon-icon-checkmark-2 white'></span>",
             labelOff: "<span class='icon16 icomoon-icon-cancel-3 white'></span>",
             enableDrag: false
        });
    });//End document ready functions
    </script
                        
 ><?php   
    }else {
echo "<script language='javascript'>window.location = '../admin/'</script>";
}
?>
